﻿using System;

namespace PTop.Domain.Entity.Questionnaire
{
    /// <summary>
    /// 调查问卷答题Entity
    /// </summary>	
    public class QnAnswerEntity : IEntity<QnAnswerEntity>, ICreationAudited
    {

        /// <summary>
        /// 
        /// </summary>
        public string F_Id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_PaperId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_PaperTitle { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_QuestionId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_Question { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_Answer { get; set; }

        public bool F_Option1 { get; set; }
        public bool F_Option2 { get; set; }
        public bool F_Option3 { get; set; }
        public bool F_Option4 { get; set; }
        public bool F_Option5 { get; set; }
        public bool F_Option6 { get; set; }
        public bool F_Option7 { get; set; }
        public bool F_Option8 { get; set; }
        public bool F_Option9 { get; set; }
        public bool F_Option10 { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string F_CreatorUserId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? F_CreatorTime { get; set; }

        public void UpdateOptions(int questionType)
        {
            F_Option1 = false;
            F_Option2 = false;
            F_Option3 = false;
            F_Option4 = false;
            F_Option5 = false;
            F_Option6 = false;
            F_Option7 = false;
            F_Option8 = false;
            F_Option9 = false;
            F_Option10 = false;
            if (questionType == 4) return;//问答题
            var ass = F_Answer.Split(',');
            foreach (var a in ass)
            {
                var i = int.Parse(a);
                switch (i)
                {
                    case 1: F_Option1 = true; break;
                    case 2: F_Option2 = true; break;
                    case 3: F_Option3 = true; break;
                    case 4: F_Option4 = true; break;
                    case 5: F_Option5 = true; break;
                    case 6: F_Option6 = true; break;
                    case 7: F_Option7 = true; break;
                    case 8: F_Option8 = true; break;
                    case 9: F_Option9 = true; break;
                    case 10: F_Option10 = true; break;
                }
            }
        }
    }
}